package com.ruoyi.common.datapermission.config;

import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.dialect.DbType;
import com.mybatisflex.core.dialect.DialectFactory;
import com.ruoyi.common.datapermission.auth.AuthDialectImpl;
import com.ruoyi.common.orm.config.MyBatisFlexConfig;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Primary
@Configuration
public class DataPermissionMybatisFlexConfig extends MyBatisFlexConfig {

    @Override
    public void customize(FlexGlobalConfig flexGlobalConfig) {
        super.customize(flexGlobalConfig);
        // 注册查询权限监听方言
        DialectFactory.registerDialect(DbType.MYSQL, new AuthDialectImpl());
    }
}
